Copied copy path!

erDiagramURL copied

erDiagram
    CUSTOMER ||--o{ ADDRESS : has
    CUSTOMER ||--o{ ORDER : places
    ORDER ||--|{ ORDER_LINE : contains
    PRODUCT ||--o{ ORDER_LINE : appears_in
    CATEGORY ||--o{ PRODUCT : groups
    SUPPLIER ||--o{ PRODUCT : supplies
    WAREHOUSE ||--o{ STOCK : holds
    PRODUCT ||--o{ STOCK : tracked_by
    ORDER ||--o| PAYMENT : paid_by
    ORDER ||--o| INVOICE : billed_by
    ORDER ||--o{ SHIPMENT : fulfilled_by
    WAREHOUSE ||--o{ SHIPMENT : ships_from
    CUSTOMER ||--o{ REVIEW : writes
    PRODUCT ||--o{ REVIEW : receives
    COUPON }o--o{ ORDER : applied_to
    CATEGORY |o--o{ CATEGORY : parent_of
    CUSTOMER {
        string id PK
        string name
        string email UK
    }
    ADDRESS {
        string id PK
        string street
        string city
        string country
    }
    ORDER {
        string id PK
        date placedAt
        string status
    }
    ORDER_LINE {
        int quantity
        float unitPrice
    }
    PRODUCT {
        string id PK
        string sku UK
        string title
        float price
    }
    CATEGORY {
        string id PK
        string name
    }
    SUPPLIER {
        string id PK
        string name
    }
    WAREHOUSE {
        string id PK
        string city
    }
    STOCK {
        int onHand
        int reserved
    }
    PAYMENT {
        string id PK
        float amount
        string method
    }
    INVOICE {
        string number PK
        date issuedAt
    }
    SHIPMENT {
        string tracking PK
        string carrier
    }
    REVIEW {
        string id PK
        int rating
        string body
    }
    COUPON {
        string code PK
        float discount
    }
```mermaid
---
width: 85vw
---
erDiagram
    CUSTOMER ||--o{ ADDRESS : has
    CUSTOMER ||--o{ ORDER : places
    ORDER ||--|{ ORDER_LINE : contains
    PRODUCT ||--o{ ORDER_LINE : appears_in
    CATEGORY ||--o{ PRODUCT : groups
    SUPPLIER ||--o{ PRODUCT : supplies
    WAREHOUSE ||--o{ STOCK : holds
    PRODUCT ||--o{ STOCK : tracked_by
    ORDER ||--o| PAYMENT : paid_by
    ORDER ||--o| INVOICE : billed_by
    ORDER ||--o{ SHIPMENT : fulfilled_by
    WAREHOUSE ||--o{ SHIPMENT : ships_from
    CUSTOMER ||--o{ REVIEW : writes
    PRODUCT ||--o{ REVIEW : receives
    COUPON }o--o{ ORDER : applied_to
    CATEGORY |o--o{ CATEGORY : parent_of
    CUSTOMER {
        string id PK
        string name
        string email UK
    }
    ADDRESS {
        string id PK
        string street
        string city
        string country
    }
    ORDER {
        string id PK
        date placedAt
        string status
    }
    ORDER_LINE {
        int quantity
        float unitPrice
    }
    PRODUCT {
        string id PK
        string sku UK
        string title
        float price
    }
    CATEGORY {
        string id PK
        string name
    }
    SUPPLIER {
        string id PK
        string name
    }
    WAREHOUSE {
        string id PK
        string city
    }
    STOCK {
        int onHand
        int reserved
    }
    PAYMENT {
        string id PK
        float amount
        string method
    }
    INVOICE {
        string number PK
        date issuedAt
    }
    SHIPMENT {
        string tracking PK
        string carrier
    }
    REVIEW {
        string id PK
        int rating
        string body
    }
    COUPON {
        string code PK
        float discount
    }
```